<?
	session_start();
?>
<script language="javascript">
	function Validate(){

		if(document.forms[0].nik.value == ""){
			alert("Maaf, NIK tidak boleh kosong ...");
			document.forms[0].nik.focus();
			return false;
		}

		if(document.forms[0].tahun.value == ""){
			alert("Maaf, Tahun tidak boleh kosong ...");
			document.forms[0].tahun.focus();
			return false;
		}
		
		if(document.forms[0].unsur.value == ""){
			alert("Maaf, Unsur Penilaian harus dipilih ...");
			document.forms[0].unsur.focus();
			return false;
		}
		
		if(document.forms[0].nilai1.value == ""){
			alert("Maaf, Nilai 1 harus dipilih ...");
			document.forms[0].nilai1.focus();
			return false;
		}
		
		if(document.forms[0].nilai2.value == ""){
			alert("Maaf, Nilai 2 harus dipilih ...");
			document.forms[0].nilai2.focus();
			return false;
		}


		if(document.forms[0].nilai3.value == ""){
			alert("Maaf, Nilai 3 harus dipilih ...");
			document.forms[0].nilai3.focus();
			return false;
		}
		
		if(document.forms[0].cat_penilai.value == ""){
			alert("Maaf, Kategori penilaian harus dipilih ...");
			document.forms[0].cat_penilai.focus();
			return false;
		}
		
		document.forms[0].submit();
	}

</script>
<link rel="stylesheet" type="text/css" href="../style/style.css">
<body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">
<form target="_parent" action="../lib/save.php" method="post">
<input type="hidden" name="nik" value="<?=$HTTP_GET_VARS['nik']?>">
<input type="hidden" name="tahun" value="<?=$HTTP_GET_VARS['periode']?>">
<input type="hidden" name="cat" value="lp_detail" />
<input type="hidden" name="cat_penilai" value="<?=$HTTP_GET_VARS['kat']?>">
<fieldset><legend><b>Table Penilaian</b></legend>
<table>
 <tr class="headlist">
  <td>No.</td>
  <td>Unsur Penilaian</td>
  <td>Nilai</td>
 </tr>
 <?
	include("../lib/config.php");
    $sUnsur = mssql_query("SELECT ROW_NUMBER() OVER (ORDER BY unsur_penilai)-1 AS No , unsur_penilai, unsurName FROM MstUnsurLP2 A, S_LP_Cat_Nilai B WHERE B.unsur_penilai=A.UnsurID AND category='".$HTTP_GET_VARS['kat']."' ORDER BY unsurID ASC",$conn);
	while($rUnsur = mssql_fetch_array($sUnsur)){
		echo"
		<tr class=contentlist>
		 <td align=right>".($rUnsur[No]+1)."</td>
		 <td>
			<input type='hidden' value='".$rUnsur[unsur_penilai]."' name='id_unsur[]'>
			$rUnsur[unsurName]
		 </td>
		 <td>";
		 for($j=1;$j<=5;$j++){
		 	if($j == 1){
				echo'
				&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="radio" name="NN_'.$rUnsur[No].'" value="'.$j.'" checked />'.$j.'
				&nbsp;&nbsp;&nbsp;';
			}
			else{
				echo'
				<input type="radio" name="NN_'.$rUnsur[No].'" value="'.$j.'" />'.$j.'
				&nbsp;&nbsp;&nbsp;';
			}
		 }
		 echo"</td>
		</tr>
		";
	}
	
 ?>
 <tr>
  <td colspan="3" style="font-size:10px;">
  <b>Catatan:</b><br />
  <textarea cols="90" rows="3" name="catatan"><?=$row[catatan]?></textarea>
  <input type="hidden" value="<?=$_SESSION['user_login']?>" name="penilai" />
  </td>
 </tr>
 <tr>
  <td colspan="3" align="right">
  <input type="hidden" name="cat" value="lp_detail" />
  <input type="hidden" name="no" value="<?=$row[No]?>" />
  <input type="button" value="Batal" class="button" onClick="Javascript:history.back();" />
  <input type="submit" value="Simpan" class="button" />
  </td>
 </tr>
 </table>
 </fieldset>
 </form>